export { };
// 类和接口；

// 定义一个接口
interface Eat {
  eat(foodName: string): void
}
interface Drink {
  drink(foodName: string): void
}

// 让Person类去实现接口类中定义的函数
// class Person implements Eat, Drink  ，表示让Person类去实现 Eat,Drink接口里面的方法，必须在Person里面定义eat,drink方法。
class Person implements Eat, Drink {
  name: string = '李四';
  age: number = 22;
  sex: boolean = true;

  // ES7后，允许你不写 构造器;  constructor(){}

  eat(foodName: string): void {
    console.log(this.name + '在吃' + foodName);
  }

  drink(foodName: string): void {
    console.log(this.name + '在喝' + foodName);
  }

}

new Person().eat('苹果') //李四在吃苹果

